
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.pv168.reminder.swing.workers;

import cz.muni.fi.pv168.reminder.entities.Task;
import cz.muni.fi.pv168.reminder.entities.Worker;
import cz.muni.fi.pv168.reminder.managers.AssignmentManager;
import cz.muni.fi.pv168.reminder.managers.implementation.AssignmentManagerImpl;
import cz.muni.fi.pv168.reminder.swing.FrameMainWindow;
import java.util.List;
import javax.swing.SwingWorker;

/**
 *
 * @author Adic
 */
public class GetWorkersOfTaskSwingWorker extends SwingWorker<List<Worker>, Void>{
    private Task task;
    
    public GetWorkersOfTaskSwingWorker(Task task) {
        this.task = task;
    }


    @Override
    protected List<Worker> doInBackground() throws Exception {
        AssignmentManager assignmentManager = new AssignmentManagerImpl();
        assignmentManager.setDataSource(FrameMainWindow.getDataSource());
        return assignmentManager.findWorkersOfTask(task);      
    }
    
}

